# -*- coding: utf-8 -*-
import oss2
import os

endpoint = os.environ['OSS_ENDPOINT']
auth = oss2.Auth(os.environ['ALIBABA_CLOUD_ACCESS_KEY_ID'], os.environ['ALIBABA_CLOUD_ACCESS_KEY_SECRET'])
bucket = oss2.Bucket(auth, endpoint, os.environ['OSS_BUCKET'])


def upload_stream(object_name, stream):
    bucket.put_object(object_name, stream)
    return bucket.sign_url('GET', object_name, 3600)
